var arr1 = 1;
console.log(arr1);
var arr2 = "123";
console.log(arr2);
var arr3 = true;
console.log(arr3);
function say() {
    console.log("定义void函数");
}
console.log(say());
function err() {
    throw new Error();
}
var newarr1 = [1, 2, 3];
console.log(newarr1);
var newarr2 = ["4", "5", "6"];
console.log(newarr2);
var newarr3 = [true, false];
console.log(newarr3);
console.log("数组求和");
var Add = [2, 8, 9, 6, 5, 8, 7];
var num = 0;
console.log(num);
// function num(Add:number):void{
//     console.log(Add);
// }
Add.forEach(function (item, index) {
    num += item;
});
console.log(num);
function isTrue(val) {
    switch (typeof val) {
        case "number":
            return true;
            break;
        case "undefined":
            return false;
            break;
        case "object":
            return true;
            break;
        default:
            break;
    }
}
console.log(isTrue(undefined));
function setItem(val, ele) {
    var num = 0;
    var arr = val.split('');
    arr.forEach(function (item, index) {
        if (item == ele) {
            num += 1;
        }
    });
    return num;
}
// console.log(setItem);
